package com.atguigu.tingshu.album.config;

import io.minio.MinioClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author Mahone
 */
@Configuration
public class MinIOConfig {

    @Autowired
    private MinioConstantProperties prop;

    /**
     * 将操作MInIO客户端对象注册到IOC容器中
     * @return
     */
    @Bean
    public MinioClient minioClient(){
        return MinioClient.builder()
                .endpoint(prop.getEndpointUrl())
                .credentials(prop.getAccessKey(), prop.getSecreKey())
                .build();
    }
}
